package com.sam.im.heiqun.uis.activities;

import android.os.Bundle;
import android.webkit.WebView;
import android.webkit.WebViewClient;

import com.sam.im.heiqun.R;
import com.sam.im.heiqun.nets.PGApi;
import com.yuyh.library.uis.activitys.BaseSwipeBackActivity;

import butterknife.BindView;

public class RegisterAgreementActivity extends BaseSwipeBackActivity {

    @BindView(R.id.webView)
    WebView webView;

    @Override
    public int getContentViewId() {
        return R.layout.activity_register_agreement;
    }

    @Override
    protected String getTitleText() {
        return getResources().getString(R.string.register_agreement);
    }

    @Override
    protected void initViews(Bundle savedInstanceState) {
        init();
    }

    private void init(){
        webView = (WebView) findViewById(R.id.webView);
        //WebView加载web资源
        webView.loadUrl(PGApi.getPayPalUrl+"registDoc");
        //覆盖WebView默认使用第三方或系统默认浏览器打开网页的行为，使网页用WebView打开
        webView.setWebViewClient(new WebViewClient(){
            @Override
            public boolean shouldOverrideUrlLoading(WebView view, String url) {
                // TODO Auto-generated method stub
                //返回值是true的时候控制去WebView打开，为false调用系统浏览器或第三方浏览器
                view.loadUrl(url);
                return true;
            }
        });
    }

}
